package com.zhl.sharding_jdbc_study_demo.service;

import com.zhl.sharding_jdbc_study_demo.dao.UserinfoDAO;
import com.zhl.sharding_jdbc_study_demo.pojo.Userinfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@org.springframework.stereotype.Service
public class Service {

    @Autowired
    UserinfoDAO userinfoDAO;
    public Integer add(){
        int i = (int) Math.ceil(Math.random()*10);
        Userinfo userinfo = new Userinfo();
        userinfo.setName("name:"+i);
        return userinfoDAO.add(userinfo);
    }
    public List<Userinfo> findall(){
        return userinfoDAO.findAll();
    }
}
